package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.TicketBean;
import com.project.service.ITicketService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@RequestMapping("ticket")
public class TicketController {
//    @Value("${server.port}")
//    private String port;
    @Autowired
    private ITicketService ticketService;
    @RequestMapping("findByItem")
    public Page<TicketBean> findByItem(@RequestParam("pageNO") Integer pageNO,
                                       @RequestParam("movieName")  String movieName,
                                       @RequestParam("cinema")  String cinema,
                                       @RequestParam("seriesName")  String seriesName,
                                       @RequestParam("row") String row) {
        Page<TicketBean>page=new Page<>();
        IPage<TicketBean> ipage=ticketService.findByItem(pageNO,movieName,cinema,seriesName,row);
        BeanUtils.copyProperties(ipage,page);
        return page;
    }
}
